package com.panfeng.xcloud.tracker;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import zipkin2.server.internal.EnableZipkinServer;
import zipkin2.storage.mysql.v1.MySQLStorage;

import javax.sql.DataSource;

@SpringBootApplication
@EnableZipkinServer
@EnableEurekaClient
@Slf4j
public class ZipkinServerApp {

	public static void main(String[] args) {
		log.info(">>> 启动 ZipkinServerApp server 开始 <<<");
		SpringApplication.run(ZipkinServerApp.class, args);
		log.info(">>> 启动 ZipkinServerApp server 结束<<<");
	}

	@Bean
	public MySQLStorage mySQLStorage(DataSource dataSource) {
		return MySQLStorage.newBuilder().datasource(dataSource).executor(Runnable::run).build();
	}

}
